package com.fruit.web.bo.impl;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import com.fruit.utils.DESPlusUtil;
import com.fruit.web.bo.AbstractOrder;

public class Order extends AbstractOrder implements Serializable {
	private static final long serialVersionUID = -8106629465344224740L;
	private Customer customer = new Customer();
	private Set<OrderDetail> orderDetails = new HashSet<OrderDetail>();
	public Order(){	
	}
	public Customer getCustomer() {
		return customer;
	}
	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	public Set<OrderDetail> getOrderDetails() {
		return orderDetails;
	}
	public void setOrderDetails(Set<OrderDetail> orderDetails) {
		this.orderDetails = orderDetails;
	}
	
	public List<OrderDetail> getOrderDetailsDataModel(){
		List<OrderDetail> result = new ArrayList<OrderDetail>();
		if (null != this.getOrderDetails() && !(this.getOrderDetails().isEmpty())) {
			Iterator<OrderDetail> it = this.getOrderDetails().iterator();
			while (it.hasNext()) {
				OrderDetail tempOrderDetail= new OrderDetail();
				tempOrderDetail = it.next();
				result.add(tempOrderDetail);
			}
		}
		return result;
	}
}
